package org.example.font.mapper;


import org.apache.ibatis.annotations.*;
import org.example.font.model.Emp;
import org.example.font.model.EmpExpr;
import org.example.font.model.EmpQueryParam;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface EmpMapper {
    List<Emp> list(EmpQueryParam param);

    // 获取到生成的id
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into emp(username, name, gender, phone, job, salary, image, entry_date, dept_id, create_time, update_time) " +
            "values (#{username},#{name},#{gender},#{phone},#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")
    void insert(Emp emp);



    void deleteById(List<Integer> ids);
    @Select("select id, username, name, gender, image, job, salary, entry_date, dept_id, create_time, update_time from emp where id = #{id}")
    Emp findById(Integer id);


    void update(Emp emp);
    @Select("select id, username, name, gender, image, job, salary, entry_date, dept_id, create_time, update_time from emp")
    List<Emp> findAll();

    @Select("select id, username, name from emp where username = #{username} and password = #{password}")
    Emp login(Emp emp);
}
